import { Component, Inject } from '@angular/core';
import { IonicPage, NavParams, ModalController, ViewController } from 'ionic-angular';

// 常量
import * as PageConstant from '../../../constant/pageConstant';
import * as Constant from '../../../constant/constant';
/**
 * 绑定银行卡申请
 */
@IonicPage()
@Component({
  selector: 'page-bind-bank-apply',
  templateUrl: 'bind-bank-apply.html',
})
export class BindBankApplyPage {

  // 用户信息
  private userInfo: any;

  // 是否同意协议
  private hasActive: boolean= true;

  constructor(
    public modalCtrl: ModalController,
    private navParams: NavParams,
    @Inject('user') private userService,
    public viewCtrl: ViewController,
  )
  {
    debugger;
    this.userInfo = this.navParams.get('data');
  }

  /*** 页面进入
   * */
  ionViewWillEnter() {}

  /*** 页面离开
   * */
  ionViewWillLeave() {}


  /*** 清除昵称
   * */
  public clearUserName(): void
  {
    this.userInfo.bankphone='';
  }

  /*** 切换是否同意
  * */
  executeChange()
  {
    this.hasActive = !this.hasActive;
  }

  /*** 执行同意
  * */
  executeAgree()
  {
    debugger;
    this.userService.bindBankCard(this.userInfo,this.viewCtrl);
  }

  /*** 去服务协议页面
  * */
  doServiceAgreement()
  {
    /*let modal = this.modalCtrl.create(PageConstant.ServiceAgreementPage, {
      data: Constant.ALIPAY_PROTOCOL
    },{
      showBackdrop: false,
      enableBackdropDismiss: false,
      // enterAnimation: 'modal-scale-up-enter',
      // leaveAnimation: 'modal-scale-up-leave'
    });
    modal.present();*/
  }
}
